/**
 * @filename:SubCourseServiceImpl Course
 * @project constract  V1.0
 * Copyright(c) 2018 gong Co. Ltd.
 * All right reserved.
 */
package com.znufe.exam.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.znufe.exam.domain.subcourse.SubCourseResponseObject;
import com.znufe.exam.viewmodel.admin.subCourse.SubCoursePageRequestVm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.znufe.exam.domain.SubCourse;
import com.znufe.exam.repository.SubCourseMapper;
import com.znufe.exam.service.SubCourseService;

/**
 *
 * @Description:  课程表——SERVICEIMPL
 * @Author:       gong
 * @CreateDate:   Course
 * @Version:      V1.0
 *
 */
@Service
public class SubCourseServiceImpl extends BaseServiceImpl<SubCourse> implements SubCourseService {

	private final SubCourseMapper subCourseMapper;

	@Autowired
    public SubCourseServiceImpl(SubCourseMapper subCourseMapper){
	    super(subCourseMapper);
	    this.subCourseMapper = subCourseMapper;
    }
	//查询对象
	@Override
	public SubCourse selectByPrimaryKey(Integer id) {
		return subCourseMapper.selectByPrimaryKey(id);
	}

	//删除对象
	@Override
	public int deleteByPrimaryKey(Integer id) {
		return subCourseMapper.deleteByPrimaryKey(id);
	}

    //添加对象
    @Override
    public int insertSelective(SubCourse subCourse) {
        return subCourseMapper.insertSelective(subCourse);
    }

    //修改对象
	@Override
	public int updateByPrimaryKeySelective(SubCourse subCourse) {
		return subCourseMapper.updateByPrimaryKeySelective(subCourse);
	}

	//查询集合
	@Override
	public List<SubCourse> querySubCourseList(SubCourse subCourse) {
		return subCourseMapper.querySubCourseList(subCourse);
	}

    @Override
    public List<Integer> getAllLecturerId(List<Integer> ids) {
        return subCourseMapper.getAllLecturerId(ids);
    }

    /**
     * 分页展示视频信息
     * @param requestVm
     * @return
     */
    @Override
    public PageInfo<SubCourseResponseObject> subCoursePage(SubCoursePageRequestVm requestVm) {
        return PageHelper.startPage(requestVm.getPageNum(),requestVm.getPageSize(),
                "id desc").doSelectPageInfo(()->
                subCourseMapper.subCoursePage(requestVm));
    }

    @Override
    public SubCourse selectSubCourseByName(String subCourseName) {
        return subCourseMapper.selectSubCourseByName(subCourseName);
    }

    @Override
    public List<SubCourse> getAllVideo() {
        return subCourseMapper.getAllVideo();
    }

    @Override
    public List<SubCourse> getSubCourseByIds(List<Integer> subCourseIds) {
        return subCourseMapper.getSubCourseByIds(subCourseIds);
    }
}
